-- 返回不为nil时说明连接服务器有变动

local key = KEYS[1]
local hKey = KEYS[2]
local addressAndPort = KEYS[3]
local val = redis.call('hget', key, hKey)

if val and val == addressAndPort then
    return nil
else
    redis.call('hset', key, hKey, addressAndPort)
    if val then
        return val
    end

    return nil
end
